package com.brian.hello;

import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Hello_androidActivity extends Activity {
	/** Called when the activity is first created. */
	int counter;
	Button addButton, subButton;
	TextView displayTextView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		counter = 0;
		addButton = (Button) findViewById(R.id.bAdd);
		subButton = (Button) findViewById(R.id.bSub);
		displayTextView = (TextView) findViewById(R.id.tvDisplay);
		addButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				displayTextView.setGravity(Gravity.LEFT);
				counter++;
				displayTextView.setText("Your total is " + counter);
			}
		});
		subButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				counter--;
				displayTextView.setText("Your total is " + counter);
			}
		});
	}
}